/*
 *
 */
package org.jiscinvolve.astrodabis.barberry.hibernate.core;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.ManyToOne;
import javax.persistence.JoinColumn;
import javax.persistence.MappedSuperclass;

import org.jiscinvolve.astrodabis.barberry.common.core.Owned;
import org.jiscinvolve.astrodabis.barberry.common.core.Account;

/**
 *
 */
@MappedSuperclass
public class OwnedEntity
extends TrackedEntity
implements Owned
    {

    /**
     * Our debug logger.
     * 
     */
    private static Log log = LogFactory.getLog(OwnedEntity.class);

    public static final String DB_OWNER_COL = "owner" ;

    protected OwnedEntity()
        {
        super();
        }

    protected OwnedEntity(Account owner)
        {
        super(true);
        this.owner = owner ;
        }

    @ManyToOne(
        targetEntity = AccountEntity.class
        )
    @JoinColumn(
        name = DB_OWNER_COL,
        unique = false,
        nullable = false,
        updatable = false
        )
    private Account owner ;

    @Override
    public Account owner()
        {
        return this.owner ;
        }
    }

